package dyyx.cli;

import dyyx.dto.CmdDTO;
import dyyx.util.CommUtil;
import dyyx.util.ShellUtil;

public class RunShellMain {
	
	
	

    public static void main(String[] args) throws Exception{   	
    	  
        int argnum = args.length;
        String shell = null;
        
        if(argnum>0){
        	shell = args[0];
        }
        
        if(CommUtil.isBlank(shell)){
        	System.out.println("shell is blank");
        	return;
        }
        
        
        CmdDTO dto = new CmdDTO();
        dto.cmd = shell;
        ShellUtil.execute(dto);
        String error = dto.error;

        
        System.out.println("shell:"+dto.cmd);
        System.out.println("result:"+dto.result);
        
        if(CommUtil.isNotBlank(error)){
            System.out.println("error:\n"+dto.error);
        }
        System.out.println("info:\n"+dto.info);


        
        
    }
}
